package cn.thoughtworks.school.utils;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.io.UnsupportedEncodingException;

public class JwtUtil {

  static final String SECRET = "ThisIsASecret";

  public static String build(String jsonStr) throws UnsupportedEncodingException {
    return Jwts.builder()
      .setSubject(jsonStr)
      .signWith(SignatureAlgorithm.HS512, SECRET.getBytes("UTF-8"))
      .compact();
  }
}
